home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Plus 1995 #1
/
Amiga Plus 1995 #1.iso
/
fish-disketten
/
fish_691-700
/
d695
/
icalc
/
s
/
icalc.init
next >
Wrap
Text File
|
1994-12-13
|
2KB
|
55 lines
# Standard startup-file for icalc.
# Updated for version 2.0. Also, you may want to include other scripts
# (such as gamma.ic) by read command.
#
# MWS, February 1992.
silent # switch off confirmation of definitions
# function informing you how long icalc session has been running in minutes.
_sessionstart = time(0)
func session() = time(_sessionstart) / 60
# simple stopwatch functions
func start() = (_start = time(0))
func stop() = time(_start)
# a few simple time-savers
func deg(z) = DEG*z # convert radians to degrees
func rad(z) = z/DEG # and degrees to radians
func log(z) = ln(z)/LOG10 # base-10 logarithm
func lg(z) = ln(z)/LOG2 # base-2 logarithm
func logn(z,n) = ln(z)/ln(n) # base-n logarithm
# inverse hyperbolic trig functions
func asinh(z) = -i*asin(i*z)
func acosh(z) = -i*acos(z)
func atanh(z) = i*atan(-i*z)
# combinatorics - could be replaced with defs in gamma.ic
func fact(n) = Prod(_n=1,n,_n)
func perm(n,r) = Prod(_n=n-r+1,n,_n)
func comb(n,r) = perm(n,r)/fact(r)
# miscellaneous
# fractional part of a number
func frac(z) = Re(z - floor(z))
# round real & imag parts
func round(z,places) = int(z*10^places)/10^places
# create complex number from modulus and argument
func polar(r,theta) = r*exp(i*theta)
# create complex number from real and imaginary parts
func complex(real,imag) = real + i*imag
# convert decimal hours to hours, mins, seconds
func hms(h) = { print(floor(h)); print(floor(_t = frac(h)*60)); frac(_t)*60; }
# convert hours, mins, seconds to decimal hours
func hours(h,m,s) = h+m/60+s/3600
verbose # restore display of results, messages